<template>
  <div id="recoveryRate">
    <div class="container">
      <DataTable
        rowKey="adminId"
        :btns="btns"
        :tableData="Data"
        :tableColumn="tableColumn"
        :pageConfig="pageConfig"
        @refresh="getList"
      />
    </div>
  </div>
</template>
<script lang='ts'>
import { Component, Watch, Vue } from 'vue-property-decorator';

@Component
export default class recoveryRate extends Vue {
  Data: any[] = [];
  tableColumn: any = {
    account: {
      label: '材料编码',
      width: 120
    },
    userName: {
      label: '材料名称',
      width: 120
    },
    roleName: {
      label: '规格',
      width: 100
    },
    roleName1: {
      label: '型号',
      width: 100
    },
    roleName2: {
      label: '单位',
      width: 100
    },
    roleName3: {
      label: '累计进场',
      width: 100
    },
    roleName4: {
      label: '累计周转',
      width: 100
    },
    roleName5: {
      label: '在场数量',
      width: 100
    },
    roleName6: {
      label: '回收率',
      width: 100
    }
  };
  pageConfig: any = {
    current: 1,
    total: 10,
    pageSize: 10,
    onChange: this.changePage
  };
  btns: any = [
    {
      label: '导出',
      icon: 'export',
      callback: () => this.exportOut
    }
  ];

  init () {
    // this.getList();
  }
  getList () {
    let data = {
      page: this.pageConfig.current,
      size: this.pageConfig.pageSize
    };
    this.$api.adminAdminUserListFetch(data).then((res: any) => {
      this.Data = res.data.records;
      this.pageConfig.total = res.data.total;
      if (!this.Data.length && this.pageConfig.current > 1) {
        --this.pageConfig.current;
        this.getList();
      }
    });
  }
  changePage (val: number) {
    this.pageConfig.current = val;
    this.getList();
  }
  exportOut () {}
}
</script>
<style lang='scss' scoped>
</style>
